import { createApp } from 'vue'
//1 引用路由
import {createRouter,createWebHashHistory} from 'vue-router'
import './style.css'
import App from './App.vue'
import Home from "./components/home.vue";
import Goods from "./components/goods.vue";
import Play from "./components/play.vue";
import ShangCheng from "./components/shangCheng.vue";
import SheQu from "./components/sheQu.vue";
import ZiLiao from "./components/ziLiao.vue";
import Index from './components/index.vue'
// 2定义路由
const routes = [
    { path: '/', component: Index
        ,children:[
            {
                path: 'home',
                component: Home,
            },
            {
                path: 'she_qu',
                component: SheQu,
            },
            {
                path: 'shang_cheng',
                component: ShangCheng,
            },
        ] },
    { path: '/zi_liao', component: ZiLiao },
    { path: '/goods/:ap', component: Goods },
    { path: '/play', component: Play },
]
//3实例化路由
const router = createRouter({
    // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
    history: createWebHashHistory(),
    routes, // `routes: routes` 的缩写
})
//4 挂载路由
createApp(App).use(router).mount('#app')
